/** 
 * http://www.oscca.gov.cn/News/201012/News_1199.htm
 */
 
#ifndef SM_SM3_H
#define SM_SM3_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif


typedef struct SM3_WorkArea_st
{
    uint8_t B[64];
    uint64_t length;
    uint32_t V[8];
} SM3_WorkArea;

#define SM3_HASH_LENGTH     32

/**
 * 计算指定数据的Sm3的
 */
void SM3_Hash(const uint8_t *message, uint32_t length, uint8_t value[SM3_HASH_LENGTH]);

void SM3_Initialize(SM3_WorkArea *sm3);

/**
 * 在一次计算中，前后Input数据的总长度小于 0x10000000000000000/0x08
 */
void SM3_Input(SM3_WorkArea *sm3, const uint8_t* message, uint32_t length);

void SM3_Result(SM3_WorkArea* sm3, uint8_t value[SM3_HASH_LENGTH]);


#ifdef __cplusplus
} /* extern "C" { */
#endif

#endif // SM_SM3_H

